global tabOptions "cells("mean(fmt(%9.4f)) b(star fmt(%9.4f) )" "sd(par fmt(%9.4f)) se(par fmt(2))") label collabels(none)"


*Panel a: inputs data

use "$dataDir/dataset_admin_field", replace
keep if year<=2014
		local depvar "sug_manual_cut sug_mecanic_cut tech_total_cutters sug_hect_harvested sug_raw_ton kabe karbe eff_sacarosa_fabrica"
		la var karbe "Sugarcane processing efficency"
		la var eff_sacarosa_fabrica "Sugar extraction efficiency"
		la var kabe "Sugar production efficiency"

eststo field_regulated: estpost su `depvar' if treatment==1		
eststo field_unregulated: estpost su `depvar' if treatment==0				

esttab field_regulated field_unregulated using "$mainDir/tables/TabA1_sumstats_exempt_nonexempt.tex", replace cells("mean(fmt(%12.2f))" "sd(par fmt(%12.2f))") label collabels(none) postfoot(" \hline") nolines nonotes noobs brackets prehead("\begin{tabular}{l*{3}{c}} \hline") posthead(" & Regulated facilities & Unregulated facilities \\ \hline & \multicolumn{2}{c}{Panel a: Inputs data} \\   ")

		

*Panel b: outputs data

use "$dataDir/dataset_admin_fabrica", replace
	drop if year==2011
keep if year<=2014

	local depvar "sugarcaneprocessedraw  total_sugar_production total_sugar_prod_perday"		

eststo fabrica_regulated: estpost su `depvar' if treatment==1		
eststo fabrica_unregulated: estpost su `depvar' if treatment==0				

esttab fabrica_regulated fabrica_unregulated using "$mainDir/tables/TabA1_sumstats_exempt_nonexempt.tex", append  cells("mean(fmt(%12.2f)) " "sd(par fmt(%12.2f))") label collabels(none) prehead(" ") nonumbers nomtitle nonotes brackets nolines  mlabels(none)  posthead("\\ [-1.8ex] & \multicolumn{2}{c}{Panel b: Outputs data} \\    ") postfoot("\hline \end{tabular}")


